import numpy as np
from PIL import Image
a = np.array(Image.open('cat.png'))
# 输出此图的高*宽*颜色,数据类型,某个点的颜色值
print(a.shape, a.dtype, a[100, 100])
# 输出互补色并存储为cat2
b = 255-a
Image.fromarray(b).save('cat2.png')
# 输出黑色横条并存储为cat3
c = a.copy()
c[:,:,2] = 0
Image.fromarray(c).save('cat3.png')
# 输出白色横条并存储为cat4
d = a.copy()
d[:,:,2] = 255
Image.fromarray(d).save('cat4.png')
